<!DOCTYPE html>
<htm style="height: 100%;">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/default.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/official.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">

    <style>
		.active{
			padding: 6px 15px;
		}
		.list-group-item:first-child {
		    border-top-left-radius: 1px;
		    border-top-right-radius: 1px;
		}
		.col-sm-6 {
    		width: 70%;
		}

    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight" style="height:100%;">
    <div class="ibox float-e-margins" style="height:100%;">
    	<h3 style="text-align:center;width: 100%; margin: 10px;"><?php if($BPName == "null"){echo '查无流程';}else{echo $BPName;}?>
    	</h3>
        <div class="ibox-content" style="height:100%;">
        	<table width="100%" height="100%">
        		<tr>
        			<td width="50%" valign="top" style="padding-left:10%;">
        				<div class="form-group">
							<div class="col-sm-8">
				              	<div style="font-size:15px;">
				              		<input name="PResult" type="radio" checked value="0">同意
				                	<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
				        	   		<input name="PResult" type="radio" value="1">不同意
				        	   		<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
				        	   		<input name="PResult" type="radio" value="2">其他意见
				                </div>
				       		</div>
				       	</div>
				       	</br>
	       				<div class="form-group" >
                       	    <label class="col-sm-6 control-label">过程意见</label>
                            <div class="col-sm-8">
                                    <textarea id="Content" name="Content" class="form-control diff-textarea" rows="6">{$Content.Content}</textarea>
                            </div>
                      	</div>
                      	</br>
                      	 	<div class="form-group">
                                <div class="col-sm-6" style="margin: 10px 0px 0px 5px;">
                                    <button class="btn btn-primary keep" onclick="RreseContent()" type="submit">保存意见</button> &nbsp;&nbsp;&nbsp;&nbsp;
                                    <button class="Banjie btn btn-primary" onclick="BanjieProcess()">办结流程</button>
                                </div>
                            </div>
                            
                            <div class="form-group Disagree" style="display:none">
                                <div class="col-sm-6" style="margin: 10px 0px 0px 5px;">
                                    <button class="btn btn-primary keep" onclick="ReturnPprocess()" type="submit">返回前面的流程</button>
                                    <a class="btn btn-white" href="javascript:void(0);"  onclick="parent.taskApplyEnd()">申请办结</a> 
                                </div>
                            </div>
        				
        			</td>
        			<td width="50%" valign="top" height="100%">
        				<div class="form-group"  style="height: 100%;overflow-y:auto;">
                       	    <label class="col-sm-6 control-label">意见列表</label>
                            <div class="col-sm-8 ContentList"  style="height: 85%;overflow-y:auto;">
                                
                            </div>
                      	</div>
        			</td>
        		</tr>
        	</table>

            
		</div>
    </div>
</div>

<script type="text/javascript" src="__ROOT__/Public/Admin/js/jquery.min.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/layer/layer.min.js"></script>
<script>
	var PRID = {$PRID};
	var TID = {$TID};
	var PResult;
	$(function(){
		if(PRID == 0 || PRID == null){
			$(":radio").attr("disabled","disabled");
			$(".Banjie").css("display","none");
		}
 		$(":radio").click(function(){ 
			parent.PResult = PResult = $(this).val();
			if(PResult == 0){
				$(".Banjie").css("display","");
				$(".Disagree").css("display","none");
				
			}else if(PResult == 1){
				$(".Disagree").css("display","");
				$(".Banjie").css("display","none");
			}else if(PResult == 2){
				$(".Disagree").css("display","");
				$(".Banjie").css("display","none");
			}
 		});
 		getContent();
	});
	
	//保存过程意见
	function RreseContent(){
		var Content = $("#Content").val();
		$.post("{:U('Admin/TaskProcess/addProcessContent')}",{"PRID":PRID,"Content":Content},function(result){
			if(PRID == 0 || PRID == null){
				layer.msg('保存无效');
			}else{
				layer.msg('保存成功');
			}
			getContent();
		});
	}
	
	//查询 全部过程意见
	function getContent(){
		$.post("{:U('Admin/TaskProcess/getProcessContent')}",{"TID":TID},function(result){
			var html = "";
			for(var k in result){
				if(result[k].Content == null) result[k].Content = "";
				if(result[k].UserName == null) result[k].UserName = "无";
				html += "<div class=\"list-group-item active\">"+result[k].Name+"&nbsp;&nbsp;&nbsp;<span>( "+result[k].PResult+")<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;办理人&nbsp;<span>"+result[k].UserName+"<span></div><div class=\"list-group-item\">"+result[k].Content+"</div>";
			}
			$(".ContentList").html("");
			$(".ContentList").append(html);
		});
	}
	
	//返回前面流程弹窗
	function ReturnPprocess(){parent.ReturnPprocessView();}
	
	//办结当前流程
	function BanjieProcess(){
		//PRID
		layer.confirm('你确定要办结此流程吗？',{
		    btn: ['确定','取消'], //按钮
		    shade: false //不显示遮罩
		}, function(index){
				layer.close(index);
				$.post("{:U('Admin/TaskProcess/BanjieProcess')}",{"TID":TID,"PRID":PRID},function(result){
					if(result.status == 1){
						layer.msg(result.info);
						window.setInterval(parent.closeLayerP, 800); 
					}else if(result.status == 0){
						layer.msg(result.info);
					}
				})
			}, function(index){
		});
	}

	
</script>
</body>
</html>